<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>冒泡和默认事件</title>
</head>
<body>
    <script>
        function stopBubble(e){
            if(e&&e.stopPropagation){
                //非IE
                e.stopPropagation()
            }else{
                window.event.cancelBubble=true
            }
        }
        //阻止默认事件
        function stopDefault(e){
            //阻止浏览器动作
            if(e&&e.preventDefault){
                e.preventDefault()
            }else{
                window.event.returnValue=false
                return false
            }
        }
    </script>
</body>
</html>